import base64
import os

from cryptography.fernet import Fernet


class Encrypt:

    def __init__(self):
        self.key = 'Y1qbSXYno7-fj5O_KmknTkZpnHNE2kfJywUQENTBqMw='
        self.cipher_suite = Fernet(self.key)

    def cipher(self, text):
        cipher_text = self.cipher_suite.encrypt(text.encode() )
        return cipher_text.decode()

    def decrypted(self, text):
        decrypted_text = self.cipher_suite.decrypt(text)
        return decrypted_text.decode()


if __name__ == '__main__':
    cipher_text = Encrypt().cipher("upload/20240626/2ac28cbc-5fe3-45c5-a328-c32306ea9a31_附件1：燃气企业导入模板.xlsx")
    print(cipher_text)
    Encrypt().decrypted(cipher_text)
